import React,{ useState, } from 'react';
import {ButtonComp, ModalItem, GlobalProvider} from 'jh-lib';


function ClickHide(props){
    const [clicked, setClicked] = useState(false);
    function f() {
        props.onClick();
        setClicked(true)
    }
    return (
        <>
            <ButtonComp
                onClick={clicked ? null:f}
                disabled={clicked}
            >
                点我哦
            </ButtonComp>
        </>
    )
}

export default class Test extends React.Component{
    state = {
        detailLoading:false
    };
    cancel = ()=>{
        this.setState({detailLoading:false})
    };
    sayHi(){
        console.log('say Hi')
    }
    render(){
        return (
            <>
                <GlobalProvider>
                    <ModalItem
                        title='支持移动窗口'
                        isMobile={true}
                        isShowDetail = {this.state.detailLoading}
                        onOk = {()=>this.cancel()}
                        onCancel= {()=>this.cancel()}
                    >
                        <div>自定义布局详情页</div>
                    </ModalItem>
                    <ButtonComp type={'primary'} onClick={()=>{
                        this.setState({detailLoading:true})
                    }}>
                        实例
                    </ButtonComp>
                    {/*<ClickHide onClick={this.sayHi}/>*/}
                </GlobalProvider>
            </>)
    }
}
